package org.example.service.imp;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.example.bean.EmailBean;
import org.example.bean.InBoxBean;
import org.example.mapper.IInBoxMapper;
import org.example.service.IInBoxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
@Service
@Transactional
public class InBoxServiceImp implements IInBoxService {
    @Autowired
    private IInBoxMapper mapper;
    @Override
    public PageInfo<InBoxBean> cutFindAcceptByItem(Integer pageNum, Integer acceptID, String title, LocalDate starDate, LocalDate endDate) {
        PageHelper.startPage(pageNum,2);
        PageInfo pg = PageInfo.of(mapper.cutFindAcceptByItem(acceptID, title, starDate, endDate));
        return pg;
    }

    @Override
    public EmailBean findByID(Integer inBoxID) {
        mapper.update(inBoxID);
        return mapper.findByID(inBoxID);
    }

    @Override
    public void del(Integer inBoxID) {
        mapper.del(inBoxID);
    }
}
